package MtG.client.panels.cardPanelComponents.gameGards;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JPanel;

import MtG.publicClass.cardType.EmptyCard;

/**
 * NoCardInHand.java is a class that is used for filling card slots in the hand that are empty.
 * @author Marek Sirp
 * @author Jaan Sepp
 */
public class NoCard extends JPanel{
	/**
	 * Determines if a de-serialized file is compatible with this class.
	 */
	private static final long serialVersionUID = -1119058639894848720L;
	/**
	 * Card border thickness.
	 */
	private final int LINE = 4;

	/**
	 * Constructor.
	 */
	public NoCard() {	
		try {
			img = ImageIO.read(new File(new EmptyCard().getPicAddress()));
		} catch (IOException e) {
			System.out.println(e.getMessage());
		}		
		this.setPreferredSize(new Dimension(img.getWidth(null) + LINE, img.getHeight(null) + LINE));
	}
	
	/**
	 * Field that holds the reference to the image that is used when no card is in place.
	 */
	Image img = null;	
	
	public void paint(Graphics g){
		super.paint(g);
		g.drawImage(img, LINE/2, LINE/2, null);
		setBackground(getParent().getBackground());
	}	
}


